package fr.web325.servlet.client.cart;

import fr.web325.dao.ClientDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

@WebServlet("/shop/client/pay")
public class Pay extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 通过订单ID获取已提交的信息返回到order.jsp
        String order_id = (String) req.getAttribute("orderId");
        try {
            List<Map<String,Object>> orderItem = new ClientDao().getOrderItem(order_id);
            req.setAttribute("orderItem",orderItem);
            req.getRequestDispatcher("/shop/client/order.jsp").include(req,resp);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
